<?php
	global $ubi;
	$urlDelete = 'index.php?remove&type=quick_message';
	for ($i = 0; $i < count($quick_messages); $i++) {							
		$u = $usersWrote[$quick_messages[$i]->getSenderID()];		
	    $img = $imgs[$u->getUserID()];	    
?>		
	<div class="profile">
		<div class="comment">
		    <div style="text-align:center">	    		
		        <a href="#">
			        <img src="<?php echo $ubi['SERVER']['THUMBNAIL_PATH']?>/<?php echo $img?>" class="smallAvatar" /><br />	            	
		        </a>                                    
		        <a href="index.php?view&type=user&userid=<?php echo $u->getUserID();?>"><?php echo $u->getUserName();?></a>
			</div>							
		</div>
		    
		<div class="right">
			<div style="float:left">
			    <div class="date">
			    	<?php echo date('d/m/Y H:i:s', $quick_messages[$i]->getCreatedDate()) ?>
			    </div>
			    <p>
			        <?php echo $quick_messages[$i]->getContent();?>
				</p>
			</div>
			<div class="comment_icons">
				<?php
					if (isset($_SESSION['userid']) && $_SESSION['userid'] == $getVars['userid']) { 
				?>
				<a href="#quick_messages" 
	        		onclick="$.deleteQuickMessage('<?php echo $quick_messages[$i]->getQuickMessageId()?>',
	        			'<?php echo $quick_messages[$i]->getReceiverId();?>', '<?php echo $urlDelete . "&id=" . $quick_messages[$i]->getQuickMessageId()?>')">
	        			<img src="include/imgs/circle-delete.png" />
	        	</a>
	        	<?php
					} 
	        	?>
			</div>
			<div style="clear:both"></div>
		</div>
		<div style="clear:both"></div>
	</div>                            	
<?php
	} 
?>
<script language="javascript">	
	$.extend({
		deleteQuickMessage:function(id,reId,url) {		
			$.post(url,
				{id:id,reId:reId},
				function(data) {						
					if (data) {
						$('#quickMessages').load('index.php?load&view=quickMessages&userid=<?php echo $getVars['userid']?>');						
					} else {
						alert('Xóa tin nhắn không thành công !!!');
					}
				}
			);
		}	
	});	
</script>